package cn.mall.base.exception;

import cn.mall.base.utils.AjaxResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ：xc
 * @description：TODO
 * @date ：2023/12/10 22:58
 */
@ControllerAdvice
public class UserBaseExceptionHandler {


    //自定义异常处理
    @ExceptionHandler(UserBaseException.class)
    @ResponseBody
    public AjaxResult error(UserBaseException e){

        return  AjaxResult.me().setSuccess(e.getSuccess()).setMessage(e.getMessage()).setResultObj(e.getResultObj());

    }
}
